﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="manageCoffee.aspx.cs" Inherits="Manageweb_Coffee_manageCoffee" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>咖啡机管理</title>
      <link href="../images/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <table width="750" border="1" cellspacing="0" cellpadding="0" style="margin:0 auto">
            <tr>
                <td style="background-color: #507cd1; color: White; font-weight: bold; text-align: left;">
                    &nbsp;咖啡机管理
                    <asp:Label ID="LB_ID" runat="server" Visible="False"></asp:Label>
                </td>
            </tr>
        </table>
        <br />
        <table id="TABLE_Add_Mod" runat="server" border="1" cellpadding="0" cellspacing="0"
            visible="false" width="750" style="margin:0 auto">
            <tr>
                <td colspan="2" style="font-weight: bold; color: white; background-color: #507cd1;
                    text-align: left">
                    &nbsp;<asp:Label ID="LB_TableTitle" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <span lang="zh-cn">咖啡机名称</span></td>
                <td style="text-align: left">
                    <asp:TextBox ID="txtCoffeeName" runat="server" Width="240px" 
                        onmouseover="this.select();"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RFV_DDL_Class" runat="server" ControlToValidate="txtCoffeeName"
                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_Submit"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <span lang="zh-cn">价 格</span>
                </td>
                <td style="text-align: left">
                    <asp:TextBox ID="txtCoffeePrice" runat="server" Width="240px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtCoffeePrice"
                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_Submit"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtCoffeePrice"
                        Display="Dynamic" ErrorMessage="格式错误,必须为正浮点数" ValidationExpression="^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$"
                        ValidationGroup="Btn_Submit"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td>
                    数 量</td>
                <td style="text-align: left">
                    <asp:TextBox ID="txtCoffeeCount" runat="server" Width="240px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="txtCoffeeCount" Display="Dynamic" ErrorMessage="*" 
                        SetFocusOnError="True" ValidationGroup="Btn_Submit"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                        ControlToValidate="txtCoffeeCount" Display="Dynamic" ErrorMessage="只能输入正整数" 
                        SetFocusOnError="True" ValidationExpression="^[0-9]*[1-9][0-9]*$" 
                        ValidationGroup="Btn_Submit"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="font-weight: bold; color: white; background-color: #507cd1">
                    <asp:Button ID="Btn_Submit" runat="server" Text="提交" ValidationGroup="Btn_Submit" />&nbsp;<asp:Button
                        ID="Btn_Cancel" runat="server" Text="取消" />
                </td>
            </tr>
        </table>
        <br />
        <div style="text-align:center; width:750px;"> <asp:Label ID="LB_ManageUser" runat="server" Font-Bold="True" Font-Size="Small" ForeColor="Red"></asp:Label></div>
       <br />
        <table border="1" cellpadding="0" cellspacing="0" width="750px" style="margin:0 auto">
            <tr>
                <td>
                    <asp:GridView ID="GV_CoffeList" runat="server" AllowPaging="True" AllowSorting="True"
                        AutoGenerateColumns="False" CellPadding="4"  
                        ForeColor="#333333" PageSize="4" Width="100%" EmptyDataText="暂无数据" 
                        onpageindexchanging="GV_UserList_PageIndexChanging">
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#EFF3FB" />
                        <Columns>
                            <asp:BoundField DataField="name" HeaderText="咖啡机名称"
                                SortExpression="name" />
                            <asp:BoundField DataField="price" HeaderText="单价"   />
                            <asp:BoundField DataField="count" HeaderText="数量" />
                            <asp:BoundField DataField="createtime" HeaderText="更新时间" 
                                DataFormatString="{0:yyyy-MM-dd}" />
                            <asp:TemplateField HeaderText="操作">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LBtn_Add" runat="server" onclick="LBtn_Add_Click">添加</asp:LinkButton>
                                    <asp:LinkButton ID="LBtn_Mod" runat="server" 
                                        CommandArgument='<%#String.Format("{0}|{1}|{2}|{3}",Eval("name"),Eval("count"),Eval("price"),Eval("ID")) %>' OnCommand="LBtn_Mod_Command">修改</asp:LinkButton>
                                    <asp:LinkButton ID="LBtn_Del" runat="server" 
                                        CommandArgument='<%# Eval("ID") %>' 
                                        OnClientClick="return confirm('删除操作不可恢复，是否继续？')" 
                                        OnCommand="LBtn_Del_Command">删除</asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                    
                </td>
            </tr>
        </table>
        <asp:HiddenField ID="hidCoffeeID" runat="server" />
        <asp:HiddenField ID="hidOperationName" runat="server" />
    </div>
    </form>
</body>
</html>
